<?php

namespace app\index\controller\my;

use ShidianUtil\Thinkphp\Response\ApiResponse;
use ShidianUtil\Utils\CheckUtil;
use app\index\model\UM as UM;
use app\index\service\MemberSvipAgreeService;
use think\APP;
use think\Request as Request;

/**
 * MemberSvipAgree 控制器
 * Class MemberSvipAgree
 * @package app\index\controller\my;
 * @link https://www.kancloud.cn/manual/thinkphp6_0/1037509
 * @see \app\index\validate\my\MemberSvipAgree
 */
class MemberSvipAgree
{
    // 请求参数
    private Request $request;

    // service
    private MemberSvipAgreeService $service;

    public function __construct(Request $request, MemberSvipAgreeService $memberSvipAgreeService)
    {
        $this->request = $request;
        $this->service = $memberSvipAgreeService;
    }

    /**
     * 新增|修改
     * @param UM $user
     * @return ApiResponse
     * @url /my/member_svip_agree/save
     */
    public function save(UM $user): ApiResponse
    {
        $request     = $this->request;

        $this->service->modify($user,  $request->param());

        return ApiResponse::success(null);
    }

}
